package com.junlaninfo;

import java.lang.reflect.Array;
import java.util.ArrayList;

/**
 * Created by 辉 on 2020/8/6.
 */
public class Thread010 implements Runnable {
    public static volatile  int count = 0;

    @Override
    public void run() {
        for (int j = 0; j < 1000; j++) {
            count++;
        }
    }
    public static void main(String[] args) {
        ArrayList<Thread> arrayList = new ArrayList();
        Thread010 thread010 = new Thread010();
        for (int i = 0; i < 10; i++) {
            Thread thread = new Thread(thread010, "线程名字：" + i);
            thread.start();
        }
        arrayList.forEach(thread -> {
            try {
                thread.join();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        });
        System.out.println(count);
    }
}
